package thread;

class InvokeRun  implements Runnable{
	public void run(){
		for (int i = 0; i < 5; i++) {
			System.out.println(Thread.currentThread().getName()+" "+i);
		}
	}
	public static void main(String[] args) throws InterruptedException {
	for (int i = 0; i < 50; i++) {
		System.out.println(Thread.currentThread().getName()+" "+i);
		if (i==20) {
			InvokeRun st=new InvokeRun();
			
			new Thread(st,"newThread1").start();
//			new Thread(st,"newThread1").run(); 
			new Thread(st,"newThread2").start();
			Thread.sleep(1);
//			new Thread(st,"newThread2").run();
		}
		
	}	
	}
}